package com.hzhjhh.view.manageView.menus;

import java.awt.Color;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

import com.hzhjhh.view.cashierView.VenditionDialog;
import com.hzhjhh.view.manageView.MainFrame;
import com.hzhjhh.view.manageView.menus.accountMng.AccountQueryDialog;
import com.hzhjhh.view.manageView.menus.accountMng.Adminstrator;


/**
 * 菜单栏初始化-账户管理
 * 
 * @author 12083
 *
 */
public class MAccountMng {

	private static MainFrame mainFrame;
	
	public MAccountMng(MainFrame mainFrame) {
		this.mainFrame = mainFrame;
		init();
	}

	public static JMenu init() {
		JMenu accountMng = new JMenu();
		accountMng.setBackground(Color.pink);
		accountMng.setText("账户管理");
		
		// 添加/修改用户
		JMenuItem addUpdateAccount = new JMenuItem();
		addUpdateAccount.setText("添加/修改用户");
		addUpdateAccount.addActionListener(event -> {
			Adminstrator adminEnter = new Adminstrator();
		});
		
		// 个人账户查询
		JMenuItem accountQuery = new JMenuItem();
		accountQuery.setText("个人账户查询");
		accountQuery.addActionListener(event -> {
			AccountQueryDialog accountQueryDialog = new AccountQueryDialog();
		});
		
		// 后台转前台
		JMenuItem back2Front = new JMenuItem();
		back2Front.setText("后台转前台");
		back2Front.addActionListener(event -> {
			VenditionDialog venditionDialog = new VenditionDialog("超市前台收银系统");
			mainFrame.setVisible(false);
		});
		
		accountMng.add(addUpdateAccount);
		accountMng.add(accountQuery);
		accountMng.add(back2Front);
		
		return accountMng;
	}
}
